/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sun.courier.dal;

import com.sun.courier.entity.District;
import java.sql.ResultSet;
import java.util.ArrayList;

/**
 *
 * @author HONG QUAN
 */
public class DistrictDAL {
    DataAccessHelper dah = new DataAccessHelper();
    public ArrayList<District> getAllDistrict(){
        String strQuery = "Select * from District";
        ArrayList<District> lst = new ArrayList<>();
        try {
            ResultSet rs = dah.executeQuery(strQuery);
            while(rs.next()){
                District d = new District();
                d.setCityId(rs.getInt("DistrictId"));
                d.setDistrictName(rs.getString("DistrictName"));
                d.setCityId(rs.getInt("CityId"));
                lst.add(d);
            }
        } catch (Exception e) {
        }
        return lst;
    }
}
